package com.project.controller;

import com.project.bean.FacilityBean;
import com.project.bean.RoomBean;
import com.project.service.IFacilityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("fac")
public class FacilityController {
    @Autowired
    private IFacilityService service;
    @RequestMapping("addFac")
    public String addFac(FacilityBean facility,int roomId){
        RoomBean room = new RoomBean();
        room.setRoomId(roomId);
        facility.setFacRoom(room);
        service.addFac(facility);
        return "ok";
    }
    @RequestMapping("solveFac")
    public String solveFac(Integer facId,Integer roomId){
        service.solveFac(facId, roomId);
        return "ok";
    }
    @RequestMapping("findFacById")
    public List<FacilityBean> findFacById(Integer roomId){
        return service.findFacById(roomId);
    }


}
